almost done with main function