changed all np.matrix to np.ndarray objects