Work on main loop