in reply to Is there a better way to do this?

a better way

Define "better". Less code? Program running faster? More readable code? Code written according to PBP with fewer broken rules? Stricter input validation?

Alexander

--
Today I will gladly share my knowledge and experience, for there are no sweeter words than "I told you so". ;-)