code refactor - karma support