modified class connection for bidirectional communication