code refactoring. realised there was get_network_data method. so reusing it