Moved atCaret script into separate js file