used query selector to select the elements that need changing
added event handlers