refractor MainActivity