   deleteSel: (sel) ->
     if not sel.isValid()
       throw new Error "Invalid selection"
-    if not 0 <= sel.startPos.loc <= @_rte.words[sel.startPos.word].length
+    if not 0 <= sel.startPos.loc <= @getWord(sel.startPos.word).length
       throw new Error "Invalid selection"
-    if not 0 <= sel.endPos.loc <= @_rte.words[sel.endPos.word].length
+    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 = @_rte.words[s].substring(0, sel.startPos.pos)
-    newRight = @_rte.words[e].substring(sel.endPos.pos)
+    newLeft = @getWord(s).substring(0, sel.startPos.pos)
+    newRight = @getWord(e).substring(sel.endPos.pos)
 
     if s == e
-      @_rte.words[s] = newLeft + newRight
+      @setWord(s, newLeft + newRight)
 
       # delete the words in between
       @deleteWords(s+1, e)
     else
-      @_rte.words[s] = newLeft
-      @_rte.words[e] = newRight
+      @setWord(s, newLeft)
+      @setWord(e, newRight)
 
       # delete the words in between
       @deleteWords(s+1, e)

      @startPos = {word: a, pos: b}
      @endPos = {word: c, pos: d}

      attr = e

    else if a? and b? and c?
      if !( typeof a is "number" and

  isValid: ->
    @startPos.lt(@endPos)


  # Try to merge this selection with the one given in argument
  #
  merge: (s, rte) ->
    # Check if their contiguous
    if s.endPos.word == @startPos.word or
       (s.endPos.word == @startPos.word -1 and
        s.endPos.loc == rte.getWord(s.endPos.word).length() and
        @startPos.loc == 0)
      # boundaries of new selection
      start = s.startPos
      end = @endPos
      # remove link of middle words to selection
      rte.getWord(s.endPos.word).removeSel(s)
      rte.getWord(@startPos.word).removeSel(@)
    else if @endPos.word == s.startPos.word or
       (@endPos.word == s.startPos.word -1 and
        @endPos.loc == rte.getWord(@endPos.word).length() and
        s.startPos.loc == 0)
      start = @startPos
      end = s.endPos
      rte.getWord(@endPos.word).removeSel(@)
      rte.getWord(s.endPos.word).removeSel(s)
    else
      return

    nSelec = new Selection start, end, s.style
    rte.getWord()


# Class describing the Rich Text Editor type
#
class Rte
  # @property [Options] _rte the RTE object
  # @param [String] content the initial content to set
  # @option _rte [Array<Selection>] selections array containing all the current selections
  # @option _rte [Array<String>] words array containing all the words of the text
  #
  constructor: (content = '')->
    if content.constructor isnt String
      throw new Error "Only accepts strings."
    @_rte = {}
    @_rte.styles = []
    @_rte.selections = []
    @_rte.cursorInformation = {}
    @_rte.words = []
    @push(content)

  _name: "Rich Text Editor"

  val: (content)->
    if content?
