main function doc