added methods to db.py