Added filtering option to count