emit events functioning