restructure based on in_domain