Refactoring networking