adding code to count number of occurences