Implemented better ping/pong handling