Refactor transaction_spec