Test and Code Cleanup

Finished basic unit test coverage of controllers and factories.  Cleaned up code.