Network progress

and some refactoring