Basic refactoring for networking.