Modified the protocol and implemented the sampling function

Added a reply type as variable