move loaddb() out to db.c