Refactor event binding.