Added is_master flag as parameter.