Refactored getIpAddressesFromRange() method