Code for model