template code rewrite