More changes, cleanup in model.py to make it ... better.