Hey thanks Shabbir for the nomination! Nice to receive some acknowledgement!
I know I wrote that I would provide sufficient documentation/explanation for the above code and I didn't come through with that promise! I am sorry as I was busy with my final year project (we have our final presentation tomorrow!)
But as soon as it gets over, I shall work on providing adequate explanation of the program logic and if need be expand the scope of the program for more advanced matching.