refactered script to support multiple csv files