Checking network before doing stuff