Add doc comments, improve compatibility with EventEmitter API