That works too and is simpler. I was copying the way that the bash script implements it and didn't really think about it.