#61 Factor out some redundant network code.