Wrote GetSpecialVariableValue() to remove some of the duplicated code.