refactoring and added the open_events call