Remove use of getElementsByTagName and getElementsByClassName

Replace calls to these functions with querySelector and querySelectorAll