Added functions to get cursor position.