how does a domain work