Better cursor handling