added better transaction support