Karma rewrite