Improved ping script