Concurrent insertion is working. Not complete though. It still has some case when the output is not what is expected.