added domain support and enhanced tests