added a bunch of database stuff