Tweaks for DB performance using transactions