Moved database code to db.py
Removed executable bit