described the constructor
included event emitter, and fixed typo
declared the middleware function