Further work on #18, finishes #17