Refactoring the Main Activity