Fix the refresh and background caching functionality to cancel pending requests in case refresh button is clicked.
merge with internet connectivity code.