Added data models, formalized logic