refactored to included a class which handles the read/write with the CSV file