Revert "Don't use transactions"

This reverts commit 9835177ef23d346c2c99425325b7d10c5550c5f7.