optimize boradcast code