Add recursion to transact