Tag cleanup, adding doctype to rendered captured document