use csv module instead of manual string handling