Optimize ip-api routine