I am also very impressed by your solution, JR DHONA.
However, I don't understand much of how it works, could you please explain the logic behind it?