Re-implement network_gateway.py