refactor applicatyion hierachy