add some comment , format, and remove some useless code.