rewriting code