updated pretty print code to count rank triplets