Added support for changing the number of inputs and outputs.