Refactor and jasmine update