refactor, prettyprint