     xpath = xpath.replace /\/$/, ''
     xpath
 
-  collectPathsForNode: (node, visible = true) ->
-    path = @getPathTo node
-#    if @stringStartsWith path, "/HTML/BODY/DIV/TABLE/TBODY/TR/TD[2]/DIV/DIV/TABLE"
-#      console.log "Collecting " + path
-
-    # Step one: get rendered node content, and store path info
+  # This method is called recursively, to collect all the paths in a given sub-tree of the DOM.
+  collectPathsForNode: (node) ->
+    # Step one: get rendered node content, and store path info, if there is valuable content
     cont = @getNodeContent node, false
     if cont.length
-      if node.data? and node.data.replace(/\n/g, " ").trim().length is 0
-        console.log "Encountered FAKE selection for path:" + path + ". Ignoring this."
-        visible = false
-      else        
-        @allPaths[path] =
-          path: path
-          content: cont
-          length: cont.length
-          node : node
-#        if @stringStartsWith path, "/HTML/BODY/DIV/TABLE/TBODY/TR/TD[2]/DIV/DIV/TABLE"
-        unless visible then console.log path + ": collected info; visible = " + visible
-    else
-#      if @stringStartsWith path, "/HTML/BODY/DIV/TABLE/TBODY/TR/TD[2]/DIV/DIV/TABLE"
-#        console.log path + ": no real content"
-#        visible = false
+      path = @getPathTo node        
+      @allPaths[path] =
+        path: path
+        content: cont
+        length: cont.length
+        node : node
 
     # Step two: cover all children.
     # Q: should we check children even if the goven node had no rendered content?
     # I seem to remember that the answer is yes, but I don't remember why.
-    if node.hasChildNodes
-      children = node.childNodes
-      i = 0
-      while i < children.length
-        @collectPathsForNode children[i], visible
-        i++
+    if node.hasChildNodes()
+      for child in node.childNodes
+        @collectPathsForNode child        
     null
 
   getBody: -> (@rootWin.document.getElementsByTagName "body")[0]

    startIndex = if parentContent? then (parentContent.indexOf content, index) else index
    if startIndex is -1
       # content of node is not present in parent's content - probably hidden, or something similar
#       console.log "Content is not present in parent, returning"
       return index



  # Read the "text content" of a sub-tree of the DOM by creating a selection from it
  getNodeSelectionText: (node, shouldRestoreSelection = true) ->
    if shouldRestoreSelection then @saveSelection()

    sel = @selectNode node

    # read (and convert) the content of the selection
