I\'m trying to modularize the code from this answer in order to generate arbitrary number of outputs based on the input.
Using ideas from this answer, I tried creatin