Reorganize code into modules, add unit tests
This doesn't add any new functionality, just organizes code by logical units and adds full unit test coverage.
This doesn't add any new functionality, just organizes code by logical units and adds full unit test coverage.