simplify formatting scanner
removed duplicate code
code cleanup: inline functions
code cleanup: remove unused arguments