working on diagonalization