I recollect that this is @pp-mo's replacement of the code written by @pelson.
Done, thanks @rhattersley