Moved around stuff to prefer remote address if one is specified