* Ely: first attempt of multithread implementation: should use mutex to
change variables.