Improved error checking for IPv4 addresses. Improved error checking to return null earlier when invalid input detected. Added unit tests to catch new cases.