improved the code style and implementation of networking
updated the implementation of threading module
add Makefile for mac platform