domain protect refactor