Added multiple master/domain support