added function generate_submodel