Cleaning up code in model.