Sure, but thanos1983 gave the solution above beforehippo's answer giving you another solution. And maybe it is worth to consider thanos1983's different approach: one can often learn from different approaches or solutions, even though you're satisfied that your problem is solved with hippo's help.