Refactored some formatter code.