minor refactoring of pinging