Fixed some bugs regarding thread closing
Added preliminary networking files