refactored the data writer definitions