More code refactoring...
Moved unittests to separate module under tests