(maint) Refactor pretty printers, fix debug interleaving

(maint) Use lambdas to clean up writing logic
(maint) Resolve facts before printing to avoid interleaving debug output