Added functionality for variable lookup
Fixing lookup functions.