Add and revise comments. Remove unused code.