Changed the database structure. Fixed api.py.