-refactored code
-added unit tests