A bit of refactoring to make adding new output formats easier