Got it working with count and thread