Refactored MainActivity