Caret position now working
Fix an error in caret handling function
Fixing caret position handling functions