Bunch of refactoring done, tweaked some networking stuff