- replace undocumented `substr` with `substring` - remove unused code - inline a few variables - simplify ifs when possible - improve saveCollapsedComments documentation - cleanup the unused imports - remove unused variables and types