Added jasmine tests and upgraded coding style