Added function for reading from .csv file + minor changes