added code to detect wifi change and set usage of internet accordingly