Added documentation and split the receiving in the lcient up into two threads, and changed some stuff.