Added function getVariableIndex