Added adapters.py, errors.py, tests.py and made many updates to db.py