Fix client-side count query
Implement correlation query
Convert to a package