Started refactoring and writing jasmine tests.  Broke functionality exists.