added the jasmine tests and some fixes