Move some cursor handling to a callback function (instead of a channel)