avoid recursive broadcast on server shutdown; more code cleanup