code cleanup: fix typo in formatting scanner, removed explicit indentation for comments, invert conditions to reduce nesting