pretty printing and clean-up