Refactor printing code

Shorten print_successful() by pulling out helper code and adding helper
functions. Also defined header values in constructor instead of
referencing them in multiple places by their literal values.