Comments and inline documentation for model.py