refactoring + trying test with jasmine