Some refactoring in network module