Optimizing the logic to re-calculate and update the model only when needed.