Redundancy removed from the code. file consisting extra methods created. New waitfor state used, when sending data to pentra.ManualResetEvent class from C# is used for this.