Transactional file changes update.

This is a copy of #166 with my own patches applied on top of it.