Change event handler on main page to addEventListener