remove dead code, reindent, remove misleading comments