getElementNames2 function

Retrieve element names in needed format.