Set new baseline

Mix of common code, batch code, web/db code
Fix DB code

fixed DB code, tested against DB. Works for me.