diff --git a/demo/complex/midpoint-objects/functionLibraries/function-library-grouper.xml b/demo/complex/midpoint-objects/functionLibraries/function-library-grouper.xml
index f3cfdc8..8ac9b0e 100644
--- a/demo/complex/midpoint-objects/functionLibraries/function-library-grouper.xml
+++ b/demo/complex/midpoint-objects/functionLibraries/function-library-grouper.xml
@@ -73,8 +73,12 @@
 			<type>xsd:string</type>
 		</parameter>
 		<parameter>
-			<name>exportedGroupPrefix</name>
-			<type>xsd:string</type>
+			<name>groupIncludePattern</name>
+			<type>xsd:anyType</type>
+		</parameter>
+		<parameter>
+			<name>groupExcludePattern</name>
+			<type>xsd:anyType</type>
 		</parameter>
 		<parameter>
 			<name>relevantSourceId</name>
@@ -97,7 +101,7 @@
 						log.warn('No group name in membership change message, ignoring it: {}', esbEvent)
 						return null
 					}
-					isExported = groupName.startsWith(exportedGroupPrefix)
+					isExported = matches(groupName, groupIncludePattern, groupExcludePattern)
 					isSuper = groupName == superGroup
 					if (!isExported &amp;&amp; !isSuper) {
 						log.info('Irrelevant group membership change, ignoring it: {}', groupName)
@@ -129,7 +133,7 @@
 				} else if (eventType == 'GROUP_ADD' || eventType == 'GROUP_DELETE') {
 					groupName = esbEvent['name']
 					groupId = esbEvent['id']
-					isExported = groupName.startsWith(exportedGroupPrefix)
+					isExported = matches(groupName, groupIncludePattern, groupExcludePattern)
 					if (!isExported) {
 						log.info('Irrelevant group add/delete event, ignoring it: {}', groupName)
 						return null
@@ -149,6 +153,23 @@
 					log.warn('Unsupported event type: {} -> {}', eventType, esbEvent)
 					return null
 				}
+
+				def matches(String name, Collection includes, Collection excludes) {
+					matches(name, includes) &amp;&amp; !matches(name, excludes)
+				}
+
+				def matches(String name, Collection patterns) {
+					if (name == null || patterns == null) {
+						false
+					} else {
+						for (pattern in patterns) {
+							if (name ==~ pattern) {
+								return true
+							}
+						}
+						false
+					}
+				}
 			</code>
 		</script>
 		<returnType>c:UcfChangeType</returnType>
diff --git a/demo/complex/midpoint-objects/resources/resource-grouper.xml b/demo/complex/midpoint-objects/resources/resource-grouper.xml
index 4745877..e644711 100644
--- a/demo/complex/midpoint-objects/resources/resource-grouper.xml
+++ b/demo/complex/midpoint-objects/resources/resource-grouper.xml
@@ -42,8 +42,11 @@
 			<rest:username>banderson</rest:username>
 			<rest:password>password</rest:password>
 			<rest:superGroup>etc:midpointGroups</rest:superGroup>
-			<rest:rootStem>midpoint</rest:rootStem>
+			<rest:groupIncludePattern>midpoint:.*</rest:groupIncludePattern>
+			<rest:groupIncludePattern>ref:.*</rest:groupIncludePattern>
+			<rest:groupExcludePattern>ref:.*_(includes|excludes|systemOfRecord|systemOfRecordAndIncludes)</rest:groupExcludePattern>
 			<rest:subjectSource>ldap</rest:subjectSource>
+			<rest:groupSource>g:gsa</rest:groupSource>
 			<rest:ignoreSslValidation>true</rest:ignoreSslValidation>
 		</icfc:configurationProperties>
 	</connectorConfiguration>
@@ -72,9 +75,10 @@
 						// ------------------ START OF CONFIGURATION ------------------
 
 						parameters = [
-						superGroup: 'etc:midpointGroups',
-						exportedGroupPrefix: 'midpoint:',
-						relevantSourceId: 'ldap'
+							superGroup: 'etc:midpointGroups',
+							groupIncludePattern: [ 'midpoint:.*', 'ref:.*' ],
+							groupExcludePattern: [ 'ref:.*_(includes|excludes|systemOfRecord|systemOfRecordAndIncludes)' ],
+							relevantSourceId: 'ldap'
 						]
 
 						// ------------------ END OF CONFIGURATION ------------------
diff --git a/demo/complex/midpoint_server/container_files/mp-home/icf-connectors/connector-grouper-rest-0.1.jar b/demo/complex/midpoint_server/container_files/mp-home/icf-connectors/connector-grouper-rest-0.2.jar
similarity index 99%
rename from demo/complex/midpoint_server/container_files/mp-home/icf-connectors/connector-grouper-rest-0.1.jar
rename to demo/complex/midpoint_server/container_files/mp-home/icf-connectors/connector-grouper-rest-0.2.jar
index b8fe937..f0a05d4 100644
Binary files a/demo/complex/midpoint_server/container_files/mp-home/icf-connectors/connector-grouper-rest-0.1.jar and b/demo/complex/midpoint_server/container_files/mp-home/icf-connectors/connector-grouper-rest-0.2.jar differ