Thanks a ton.

The code works perfectly fine now as I wanted.