Checking for valid network definition refactored