refactor network