refactor for other output formats