porting cleanups from #20