Refactor out inline event listener