Refactoring MainActivity