rewrite app structure