Refactor MainActivity