More robust domain name parsing
Refactoring