refactored network utils