builds on #1200, fixing and tidying a few small things