abstract out transaction logic

it appears we could go further and abstract out the transaction logic