implemented new tests, small refactoring