Remove not used variable
Add support for not-HTML documents
Better error message