Improved code for domain record creation