Adding counts, removing empty entries, sorting