adding variables to code generation (currently generating invalid code)