working on database stuff

the initialization/shutdown code mainly.