refactor event api