added n instances support