Cleaned up and added sort feature to CSV serializer.