@madewokherd that's a great suggestion.  I changed to that method, simplifying the code.  I've updated the pull request with the latest improvement.