update main func