Did some cleaning up of code. Added a module for unit tests. Added a few more unit tests.