Modifying database inserts and commits to make script restarts smoother. No major changes.