modifying model code to split into parts'