[#38] Refactor middleware to return EventEmitter.