Taking filter into account to calculate scope counts
Removing unneeded code after the change in the scope counters
Custom scope visibility