working on main code