move transaction code and fix issue #280