fix creation of domain pattern.
cleaning, refactoring.