Some more complicated code generation for variables