This update completes the factoring out of database management into database.c,