Do not use Node.remove method (broken in Firefox)
Replace window.Range constructor with document.createRange()