add cursor tracking functionality