removed some dead code and fixed comments