Added code for checking for internet connection