Adding karma test / refactoring build