refactored tests, added code coverage