add grunt-karma, server refactoring