rewrite whole app