refactor network module