toClass and toElement APIs