some improvment of the code