tidy up to use CSV parser