refactory MainActivity