Move ping of google to a function; check 2nd time before shutting off router

 - Also, revise some indentation