Improved db transaction management.