Added function for counting no. of different sources