Accounted for possible tag nesting or lack of header in HTML files, fixed tests accordingly