Minor reorganization. Fixes.

Put the packer constants in a common place.
Fix more problems with multi-database handling.
Testing improvements.