add tests for helper methods, some refactoring