Handled cases where the state of the monitoring thread was vurnareble.
Took precautions while stopping the moniroting thread, now the stop flag
is mainted by individual monitoring thread.

We need to check how this change affects other monitors.