Refactored code and added plural node support for CSV and XML

Refactored the csv/xml parsing code.