extracted csv impl. to have a clean api