Refactoring to handle all kind of network configuration