refactor containsIdentifier to isVariableDefined