added optimization to code generation to reduce method sizes.