refactored multicast and singlecast to use same structure