More improvements to generic writer.