added the diagonalization