added the latest code for the protocolmanager