Make IP grabbing a bit more intelligent