changed underlying codegen variable data structure
modified code to return dual variables