refactor formatter for better performance
reformat to restore tab from spaces