Move database stuff to a subpackage; updates.
Some more work on db stuff.