[Minor] Refactoring to avoid duplicate code

Very merry end of the year :)
This is wrong. Calling ``afterTransactionComplete`` multiple times does not work anymore, because you keep the state between calls