Handle array inputs and outputs properly