document main function