Reworked it to work with xml files.