refactor network to class... again
bugfixes on network as class