added some protections against crappy webpages
refactoring: cleaner api
removed an old file