Changed to use .on (listen for emitted events) instead of listener functions
Changed to use emitted events instead of listener functions