Implement new writeDataFn system.

This commit converts all the old default value writeFn's and add utilities
for writing new ones.