Clean up code, create final dataframe