I was digging up this thread, something similar but with more granularity:
It would look like this (current approach as in the .gh script above):