Refactor formatter handling