Refactoring by creating the app as an object