Moved the subtransaction logic to its own class