saving caret position correctly, finally! Woo!!!!