refactor net helper