Refactor transaction API (minor)