Revised C callback functions