Improvements to CSV writer - more useful for generic purposes now.