Refactored to enabled easier unit testing
Unit tests. Lots of unit tests.
Added Karma for running Jasmine unit tests