   #
   # @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
+  equals: (selection)->
+    @startPos.word == selection.startPos.word and
+    @startPos.pos == selection.startPos.pos and
+    @endPos.word == selection.endPos.word and
+    @endPos.pos == selection.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)
+  in: (selection) ->
+    @startPos.lt(selection) and @endPos.gt(selection)
 
   # Returns true if the current selection is in the given selection
   #
   # @param [Selection] s the selection to compare to this
   #
-  contains: (s) ->
-    s.in(@)
+  contains: (selection) ->
+    selection.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)
+  overlaps: (selection) ->
+    @startPos.lt(selection.endPos) or @endPos.gt(selection.startPos)
 
   #TODO
   setAttr: (@attr) ->

  #
  # @param [Selection] sel the selection to delete
  #
  deleteSel: (sel) ->
    if not sel.isValid()
      throw new Error "Invalid selection"
    if not 0 <= sel.startPos.loc <= @getWord(sel.startPos.word).length
      throw new Error "Invalid selection"
    if not 0 <= sel.endPos.loc <= @getWord(sel.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)

      # delete the words in between
      @deleteWords(s+1, e)
    else
      @setWord(s, newLeft)
      @setWord(e, newRight)

      # delete the words in between
      @deleteWords(s+1, e)
      # merge
      @merge(s)

  # 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)
      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

    preSpaces = content.match PreSpacesRegExp
    currWord = @getWord index

  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
