rewrite controller