Clean up the model function.