main function all done