update the global function