diff --git a/user_migrate.sh b/user_migrate.sh
index 25b127904cdc12a784a215bc971caa0cb3812ce3..1edd5d9ba3dc4df5e93f4f85b1e4249d841b8871 100644
--- a/user_migrate.sh
+++ b/user_migrate.sh
@@ -1,13 +1,16 @@
 #!/bin/bash
 
+group_options=(gpfs4 gpfs5)
+
 user=$1
 group_to=$2
 
 if [[ -z "${group_to}" ]]; then
   echo "Usage: $0 USER TARGET_GROUP"
   exit 1
-elif [[ "${group_to}" != "gpfs4" && "${group_to}" != "gpfs5" ]]; then
-  echo "Target group should be \"gpfs4\" or \"gpfs5\", got \"${group_to}\"."
+elif [[ ! " ${group_options[*]} " =~ [[:space:]]${group_to}[[:space:]] ]]; then
+  echo "Invalid target group"
+  echo "Available options: ${group_options[*]}, got ${group_to}"
   exit 1
 fi
 
@@ -21,7 +24,6 @@ fi
 cd /cm/shared/rabbitmq_agents || exit
 source venv/bin/activate
 
-
 if [[ "$group_to" == "gpfs4" ]]; then
   group_from=gpfs5
 else