Fixed countReqs method
Generalized function