karma watching refactoring