change subdomain detection algorithm