Factor out all of the output into a separate module