clean out unused code, add comments