Added code to limit how many input and output fields can be added