main function complete
main function complete.