Refactoring and adding unit tests (finally)
Refactoring and adding unit tests (finally)