refactoring in network.h network.c