Added mapping file to dataframe parsing, and cleaned up a bit of code