Add jasmine test suite and update code