Refactored networking to make it more consistent with Renki's networking