If output is a String, I suggest to remove these `.join` and perform a `.flatten` before the final `.join`