Added a check to see if the user has internet connection.