first unit test, minor refactoring