discover gateways by sending broadcast message
Clean up code