some network logic

some network logic and tests