diff --git a/galera-cluster-verify-restore.groovy b/galera-cluster-verify-restore.groovy
index 693ee88..2e42509 100644
--- a/galera-cluster-verify-restore.groovy
+++ b/galera-cluster-verify-restore.groovy
@@ -42,34 +42,28 @@
         }
         stage('Verify status') {
             resultCode = galera.verifyGaleraStatus(pepperEnv, false, checkTimeSync)
-        }
-        if (runBackupDb) {
-            stage('Backup') {
-                deployBuild = build( job: "galera-database-backup-pipeline", parameters: [
-                    [$class: string_value, name: 'SALT_MASTER_URL', value: SALT_MASTER_URL],
-                    [$class: string_value, name: 'SALT_MASTER_CREDENTIALS', value: SALT_MASTER_CREDENTIALS],
-                    [$class: string_value, name: 'OVERRIDE_BACKUP_NODE', value: "none"],
-                    ]
-                )
-            }
-        }
-        stage('Restore') {
             if (resultCode == 128) {
                 common.errorMsg("Unable to connect to Galera Master. Trying slaves...")
                 resultCode = galera.verifyGaleraStatus(pepperEnv, true, checkTimeSync)
                 if (resultCode == 129) {
-                    common.errorMsg("Unable to obtain Galera slave minions list". "Without fixing this issue, pipeline cannot continue in verification and restoration.")
+                    common.errorMsg("Unable to obtain Galera slave minions list". "Without fixing this issue, pipeline cannot continue in verification, backup and restoration.")
                     currentBuild.result = "FAILURE"
                     return
                 } else if (resultCode == 130) {
-                    common.errorMsg("Neither master or slaves are reachable. Without fixing this issue, pipeline cannot continue in verification and restoration.")
+                    common.errorMsg("Neither master or slaves are reachable. Without fixing this issue, pipeline cannot continue in verification, backup and restoration.")
                     currentBuild.result = "FAILURE"
                     return
                 }
             }
             if (resultCode == 131) {
-                common.errorMsg("Time desynced - Click proceed when the issue is fixed or abort.")
+                common.errorMsg("Time desynced - Please fix this issue and rerun the pipeline.")
                 currentBuild.result = "FAILURE"
+                return
+            }
+            if (resultCode == 140 || resultCode == 141) {
+                common.errorMsg("Disk utilization check failed - Please fix this issue and rerun the pipeline.")
+                currentBuild.result = "FAILURE"
+                return
             }
             if (resultCode == 1) {
                 if(askConfirmation){
@@ -79,17 +73,32 @@
                 }
             } else if (resultCode > 1) {
                 if(askConfirmation){
-                    common.warningMsg("There's something wrong with the cluster, do you want to run a restore?")
+                    common.warningMsg("There's something wrong with the cluster, do you want to continue with backup and/or restore?")
                 } else {
-                    common.warningMsg("There's something wrong with the cluster, try to restore.")
+                    common.warningMsg("There's something wrong with the cluster, try to backup and/or restore.")
                 }
             } else {
                 if(askConfirmation){
-                  common.warningMsg("There seems to be everything alright with the cluster, do you still want to run a restore?")
+                  common.warningMsg("There seems to be everything alright with the cluster, do you still want to continue with backup and/or restore?")
                 } else {
-                  common.warningMsg("There seems to be everything alright with the cluster, do nothing")
+                  common.warningMsg("There seems to be everything alright with the cluster, no backup and no restoration will be done.")
+                  currentBuild.result = "SUCCESS"
+                  return
                 }
             }
+        }
+        if (runBackupDb) {
+            stage('Backup') {
+                common.infoMsg("Running backup job.")
+                deployBuild = build( job: "galera-database-backup-pipeline", parameters: [
+                    [$class: string_value, name: 'SALT_MASTER_URL', value: SALT_MASTER_URL],
+                    [$class: string_value, name: 'SALT_MASTER_CREDENTIALS', value: SALT_MASTER_CREDENTIALS],
+                    [$class: string_value, name: 'OVERRIDE_BACKUP_NODE', value: "none"],
+                    ]
+                )
+            }
+        }
+        stage('Restore') {
             if(askConfirmation){
               input message: "Are you sure you want to run a restore? Click to confirm"
             }
