Revert "simplified write"

This reverts commit ffd29b45fe8c37653887ff1c75766ce3f3b520c3.