domain_id encapsulation and multi-domain capable - functions.php