i wonder if we can use https://github.com/igorw/iter to flatten things here