Refactor check subdomain method