Fix minor bugs using thread sleep(). Divergence is found. Need to fix the code for algorithm.