Clean up printing code