Refactored the models and models/templates chapters.