Made matrix concatenation handle lists of inputs without using a recursive call