Updated custom variable operation to first search local scope, then
global instead of other way around for naming conflicts