Refactoring app functions into a single class.