almost finished, more tests are needed, for the first set of data, there is a deadlock