Moving the model code into a behavior