Master.php and factories.xml cleanup, refs #998