refactor to work with karma and testling