Added DB transactions plus minor fixes