improve broadcast code