'prettify', encode, and clean output