refactoring local-ip module after suggestions