Added EventEmitter functionality and related tests