pretty print and testing function