listEvents, some refactoring