Thread density calculation correctly