ADDED network detection functionality