Major refactor in Domain generation