Thank you so much for the inputs. I learnt something really useful from the solution you have provided. I would have never thought of setting the flag high or low for the first time in that manner, I am learning that with a few tweaks I could apply that to various other sections of my code for different purposes.