major refactor to allow passing in the domain name