Rewrite app structure