Used getElementsByTagName instead of traversing the DOM tree