Refactoring in prep for HTML formatter