overhauled the logic to remove duplicate code for csv and xml.
added schema validation step
refactored code