proper mode code generation; added is_injection such that the generated code can choose det or multi
moving upstream