remove some unused code; add comments