Clean up networking code

Signed-off-by: Jack Huey kitskub@gmail.com