Cleaned up GatherInputOutputModels so we do not need to iterate over the list of chains twice