better transaction handling