Removing try block and textCursor instance