Refactored concurrent module and fixed various algorithms.