extracting CONCURRENT_FOR as a library function