btw, since you have already written the array based function, might want to leave it there and add a hash based one as an additional function.