pull scheduleCallback out of the loop