Move ping functionality to class