Again reworked logic for counting cows.