Implement bulk-output function and refactor