database writer implmented. Need for debugging