     [container, offset]
 
   findNodeAndOffsetForLocation: (location) ->
-    index = Math.min(location.index, @getBlockCount())
     offset = 0
-
-    for currentNode in @getNodesForIndex(index)
+    for currentNode in @getNodesForIndex(location.index)
       length = nodeLength(currentNode)
-      lastNode = currentNode
-      lastOffset = offset
-
       if location.offset <= offset + length
         if currentNode.nodeType is Node.TEXT_NODE
           node = currentNode

        else if not node
          node = currentNode
          nodeOffset = offset

      offset += length
      break if offset > location.offset

    if node?
      nodeOffset = lastOffset if index < location.index
      [node, nodeOffset]
    else
      [lastNode, lastOffset]

  getNodesForIndex: (index) ->
    nodes = []

        nodes.push(node)

    nodes

  getLocationRangeAtPoint: ([clientX, clientY]) ->
    if document.caretPositionFromPoint
