refactor on main activity.