Added error checking and tests for geoip