Added checkInternetConnection function