added func to get cursor position