rewrite apps structure