Refactored for flexibility. Added basic tests for find count.