Add DOM parsing and output logic