Optimize model code.