added global variables for stack based order of ops