start rewriting scanner
reformat code