db.py updated in order to manage the two methods in a single database