I don't know why can't I write small functions when it gets to data structure and advanced traversals. I remember writing algorand merkle tree inflator and it was as sinful as this.
Lack of practice, I guess?
Mastodon server of https://doma.dev.