added code to resolve references (variables) to their true value