database.py modified