Have a look at the solution posted by @jivesinger in your other thread, much neater than what I was thinking