sorting out arrangement of inputs