rewriting tutorial