Refactored count array