Added check for internet connection and show loading dialog