Added a class for managing events and listeners