moving networking stuff to own class