arrange the code and give some comment