some fixes, better support for CSV, nicer logging