main function done