refactored for testing
more tests