added functionality to replace callback function