remove unused code and add more comment