reorder input and output definitions