improve_3

you mainly added gibbs_diag, and made many other modificaitons.