introduced Network data type plus lots of refactoring