refactoring app file