added some database stuff.

it is broken a little.