added event listener instead of onclick