 
   formatAt: (index, length, name, value, options = {}) ->
     options = _.defaults(options, DEFAULT_API_OPTIONS)
-    doAt.call(this, =>
-      formatAt.call(this, index, length, name, value)
+    _doAt.call(this, =>
+      _formatAt.call(this, index, length, name, value)
     , options)
     
   getDelta: ->
-    checkUpdate.call(this)
+    _checkUpdate.call(this)
     return @doc.toDelta()
 
   getLength: ->
     return this.getDelta().endLength
 
   getSelection: ->
-    checkUpdate.call(this)
+    _checkUpdate.call(this)
     return @selection.getRange()
 
   insertAt: (index, text, formatting = {}, options = {}) ->
     options = _.defaults(options, DEFAULT_API_OPTIONS)
-    doAt.call(this, =>
-      insertAt.call(this, index, text, formatting)
-      forceTrailingNewline.call(this)
+    _doAt.call(this, =>
+      _insertAt.call(this, index, text, formatting)
+      _forceTrailingNewline.call(this)
     , options)
 
   setDelta: (delta) ->

DEFAULT_API_OPTIONS = { silent: false, source: 'api' }


checkUpdate = ->
  if @innerHTML != @root.innerHTML
    delta = this.update()
    @innerHTML = @root.innerHTML

      @doc.mergeLines(firstLine, firstLine.next)
  )

_forceTrailingNewline = ->
  unless @doc.lines.last?.trailingNewline
    # Can't do this.insertAt since still within the doAt call, this \n will already been recorded by _trackDelta
    _insertAt.call(this, this.getLength(), "\n")

# formatAt (Number index, Number length, String name, Mixed value) ->
_formatAt = (index, length, name, value) ->
  @selection.preserve(index, 0, =>
    [line, offset] = @doc.findLineAtOffset(index)
    while line? and length > 0
