Improved CSV functionality