@ali-graham helped me work out how this is working, thanks. ... could these be rewritten with case or the ternary operator? I think the case version is probably easiest to read. I tried a few here: https://gist.github.com/jessereynolds/9045685