some refacting done on function names and thread states convention
Some answers about the system in a pdf