abstract out transaction logic

it appears we could go further and abstract out the transaction logic
Merge pull request #95 from metridoc/abstract-out-trans-logic-pull

abstract out transaction logic