Defined more db functions and implemented db.py to the routes.