Added a function to check internet connectivity