Copy and pasted networking stuff from my RTS