Emitting events instead of using callbacks