added internet connection logic