Bug fix in network search. More refactoring.