work on main function