Reorganization and unit tests
Merge pull request #134 from cloudspace/67567950_code_cleanup

Reorganization and unit tests