do some refactoring and fix a potential waste of characters in lib/format.rb