Generalized code for pings and announces