move db things into db.py