events api refactored