refactory mainActivity