refactored transaction handling into own class