updated callback function