Move internet connection check function to helpers