Updated to use flask-sqlalchemy