refactored using Event class