Tidying up, adding tests for #28