Improve sendData function
Use real event emitter