Removing dead code, and formatting thrown exceptions.
Bug fix: actually recycle document nodes!
Formatting.