add first refactoring for network
refactored network structure and add peer down autodetect
Merge branch 'bla'