rewrite application controller