Improving model's code