Refactoring Main activity