Refactored code so that it will work for any number of key:value pairs, as long as the first line of the csv file represents the keys.