Add a sorting on before write example.

Closes #44