Corrected pattern grouping so that all parts of cutout are collected, also use name to select result instead of index