Update prettyprint

A pretty major update (not just to prettyprint).

It might need a little peer review, but I think it's a worthwhile and solid update.