update main function