clean up pretty printer function