Refactoring network and tables and writing tests.