Minor code refactoring for private_ip