Remove some print statements. Add the double sort as per gemma's comment.