refactored formatter