Refactored getElements method for specific inputs, not every DOM node.