Refactor - add the transaction as return value to prepareTransaction