Added subdomain logic and code