add some comment and remove useless code