refactored domain parsing