Made output a matrix