Added count method

Added count method with filtering.