Hi Scott,

Yes you are right. I wrote it in a little bit in a rush... It could be done much efficiently

Lluís