split apart process_csv into new functions, header detection should be better