Reworked model.py