Added SQLAlchemy models and rejiggered some stuff.