doing refactor on main class