   #
   # @param [Selection] sel the selection to delete
   #
-  deleteSel: (sel) ->
-    if not sel.isValid()
+  deleteSel: (selection) ->
+    if not selection.isValid()
       throw new Error "Invalid selection"
-    if not 0 <= sel.startPos.loc <= @getWord(sel.startPos.word).length
+    if not 0 <= selection.startPos.loc <= @getWord(selection.startPos.word).length
       throw new Error "Invalid selection"
-    if not 0 <= sel.endPos.loc <= @getWord(sel.endPos.word).length
+    if not 0 <= selection.endPos.loc <= @getWord(selection.endPos.word).length
       throw new Error "Invalid selection"
 
-    s = sel.startPos.word
-    e = sel.endPos.word
-
-    newLeft = @getWord(s).substring(0, sel.startPos.pos)
-    newRight = @getWord(e).substring(sel.endPos.pos)
-
-    if s == e
-      @setWord(s, newLeft + newRight)
+    start = selection.startPos.word
+    end = selection.endPos.word
+
+    newLeft = @getWord(s).substring(0, selection.startPos.pos)
+    newRight = @getWord(e).substring(selection.endPos.pos)
+
+    if start == end
+      @setWord(start, newLeft + newRight)
 
       # delete the words in between
-      @deleteWords(s+1, e)
-    else
-      @setWord(s, newLeft)
-      @setWord(e, newRight)
+      @deleteWords(start+1, end)
+    else
+      @setWord(start, newLeft)
+      @setWord(end, newRight)
 
       # delete the words in between
-      @deleteWords(s+1, e)
+      @deleteWords(start+1, end)
       # merge
-      @merge(s)
+      @merge(start)
 
   # Insert text at position
   #
   # @param [Option] position The position where to insert text
   # @param [String] content the content to insert
   #
-  insert: (sel, content)->
-    if (_.isUndefined sel.startPos)
+  insert: (selection, content)->
+    if (_.isUndefined selection.startPos)
       throw new Error "Expected a location object as first argument"
     if not (_.isString content)
       throw new Error "Expected a string as second argument"
 
     if content.length == 0
       return
-    index = sel.startPos.word   #position to work from
-    pos = sel.startPos.pos
+    index = selection.startPos.word   #position to work from
+    pos = selection.startPos.pos
 
     preSpaces = content.match PreSpacesRegExp
     currWord = @getWord index

  #
  # @param [Selection] s the selection to compare to this
  #
  equals: (s)->
    @startPos.word == s.startPos.word and
    @startPos.pos == s.startPos.pos and
    @endPos.word == s.endPos.word and
    @endPos.pos == s.endPos.pos

  # Returns true if the given selection is in the current selection
  #
  # @param [Selection] s the selection to compare to this
  #
  in: (s) ->
    @startPos.lt(s) and @endPos.gt(s)

  # Returns true if the current selection is in the given selection
  #
  # @param [Selection] s the selection to compare to this
  #
  contains: (s) ->
    s.in(@)

  # Returns true if the given selection overlaps the current selection
  #
  # @param [Selection] s the selection to compare to this
  #
  overlaps: (s) ->
    @startPos.lt(s.endPos) or @endPos.gt(s.startPos)

  #TODO
  setAttr: (@attr) ->

  getWord: (index) ->
    if not (0 <= index < @_rte.words.length)
      throw new Error "Index out of bounds #{index}"
    @_rte.words[index].word

  # Returns the *word objects* within boundaries
