diff --git a/abort-long-running-jobs.groovy b/abort-long-running-jobs.groovy
index a612d7f..f4b4d36 100644
--- a/abort-long-running-jobs.groovy
+++ b/abort-long-running-jobs.groovy
@@ -5,33 +5,37 @@
  */
 common = new com.mirantis.mk.Common()
 
-def MAX_ALLOWED_DURATION_IN_SECONDS = 3600 * Integer.parseInt(MAX_DURATION_IN_HOURS)
 node{
   stage("Kill long running jobs"){
     def jobKilled = false
     for (int i=0; i < Jenkins.instance.items.size(); i++) {
-      def runningBuilds = _getRunningBuilds(Jenkins.instance.items[i])
-      def jobName = Jenkins.instance.items[i].name
-      for(int j=0; j < runningBuilds.size(); j++){
-        def build = runningBuilds[j]
-        int durationInSeconds = (System.currentTimeMillis() - build.getTimeInMillis())/1000.0
-        if(durationInSeconds > MAX_ALLOWED_DURATION_IN_SECONDS){
-          common.infoMsg("Aborting ${job.name}-${build.id} which is running for ${durationInSeconds}s")
-          try{
-            build.finish(hudson.model.Result.ABORTED, new java.io.IOException("Aborting build by long running jobs killer"));
-          }catch(e){
-            common.errorMsg("Error occured during aborting build: Exception: ${e}")
-          }
-        }
-      }
-    }
-    if(!jobKilled){
-      common.infoMsg("No job aborted")
+      killStuckBuilds(3600 * Integer.parseInt(MAX_DURATION_IN_HOURS), Jenkins.instance.items[i])
     }
   }
 }
 
 @NonCPS
-def _getRunningBuilds(job){
+def getRunningBuilds(job){
   return job.builds.findAll{build -> build.isBuilding()}
+}
+
+@NonCPS
+def killStuckBuilds(maxSeconds, job){
+    def result = false
+    def runningBuilds = getRunningBuilds(job)
+      def jobName = job.name
+      for(int j=0; j < runningBuilds.size(); j++){
+        int durationInSeconds = (System.currentTimeMillis() - runningBuilds[j].getTimeInMillis())/1000.0
+        if(durationInSeconds > maxSeconds){
+          def buildId = runningBuilds[j].id
+          common.infoMsg("Aborting ${jobName}-${buildId} which is running for ${durationInSeconds}s")
+          try{
+            runningBuilds[j].finish(hudson.model.Result.ABORTED, new java.io.IOException("Aborting build by long running jobs killer"));
+          }catch(e){
+            common.errorMsg("Error occured during aborting build: Exception: ${e}")
+          }
+          result = true
+        }
+      }
+      return result
 }
\ No newline at end of file
