Fancy networks

See docs/networks.md for details.

Unit tests pass, but I should write some more unit tests to test the expanded functionality before we merge this.
Better variable names please. Same goes for `i` and `j` -- these aren't loop indicies.