refactored jasmine code