Progress on #29, needs testing