Refactored the custom iterator. Removed CountDownLatch