refactor stack trace pretty printing.