cleans up printing code