rewrite the manager as a class and inherits from an EventEmitter