Moved shared code into module for default formatters.