some refactoring of the app file