bit of refactoring, improving test coverage