Reworked getElementOfType