This is a continuation of #758