refactor MainActivity