Cleanup and documentation, addition of Jasmine tests