major changes to db stuff