more like what's working, I think (TBD)
refactor blindly to my usual shell script format