minor refactor of code to get subdomain