modified callback function