Work on #188, #684; needs testing