worker: handle multiple inputs.

Right now, we still process only the first input.