Added binary geoip databases.
Made function more generic