changed ping algorithm