Added support fro declared variables.
Fixed processing of "VarRef" elements.