Refactored Main Activity