Simplify element check

The check to see if the given variable is a valid element can be massively simplified.