Indented code;
Fixed bug when counting distinct records with composite primary key;