FIxes karma file and adds small refactoring
Adds basic tests