Refactor app hierarchy