Adding CountDownLatch algorithm