refactored transaction