Some cleanup including a fix for double-pinging, it seems.