Split searching into its own module.

Searching is better done separately from the rest of the network code.
Every function in there happens to be separate, so we don't need to keep
them around for the main module.