Fixing network code. Testing algorithm.