Reworked transaction handling.