Cleaned up logic related to IP authentication.