Refactor event replies in function