Added a method for checking if an element is primitive.