adding jasmine and refactoring