refactor network manager