Kudos to the author. First because the author found a solution to a problem. See to get a solution sometimes is a problem, but here the author got a solution which may not be the best. Now the author can do research to find a more smarter way of doing it.
Second the author shared with us the solution.
Third the author is very sporting to accept criticism.
Thanks......:)