added ping functionality, introduced observer pattern