fixed currThreads placement and added while