parse csv file and do some basic data handling