added ping-pong functionality