diff --git a/Jenkinsfile b/Jenkinsfile
index 8e35656..3b662be 100644
--- a/Jenkinsfile
+++ b/Jenkinsfile
@@ -83,14 +83,6 @@ def printDebug(msg)
 
 printDebug(currentBuild.id.toString())
 printDebug(JOB_NAME)
-if(verbose)
-{
-	verbose_str = ' V=sc'
-}
-if(single_core)
-{
-	core_count_str = '1'
-}
 
 
 node('test')
@@ -113,86 +105,93 @@ node('test')
 	{
 		post_build()
 	}
+	
+}
 
 
-
-	def checkout()
+def checkout()
+{
+	stage('checkout')
 	{
-		stage('checkout')
-		{
-			if(pre_clean)
-			{
-				cleanWs()
-			}
-			sh label: 'checkout_configs', script: 'git clone ' + script_git + ' ' + script_folder
-			sh label: 'checkout_openwrt', script: 'git clone ' + git_link + ' ' + git_folder
-			def ret = sh label: 'is_build_needed', script: 'set +x; python ' + scripts_path + 'sftp_test.py -a ' + sftp_host + ' -u ' + sftp_user + ' -p ' + params.SFTP_PASSWD + ' -g ' + git_folder + ' -f ' + scripts_path + known_hosts + ' -l ' + sftp_path + '; set -x', returnStdout: true
-			if(ret.trim().equalsIgnoreCase('True'))
-			{
-				isBuildNeeded = true
-			}
-		}
-	}
-
-	def pre_build()
-	{
-		stage('pre-build')
-		{
-			sh label: 'patch_sources', script: 'cd ' + git_folder + '; patch -p1 < ../' + patch
-			sh label: 'feeds_update', script: 'cd ' + git_folder + '; ./scripts/feeds update -a'
-			sh label: 'feeds_install', script: 'cd ' + git_folder + '; ./scripts/feeds install -a'
-		}
-	}
-
-	def build()
-	{
-		stage('build')
-		{
-			sh label: 'copy_config', script: 'cp ' + config_path + 'tl_wr841_config ' + git_folder + '/.config'
-			try
-			{
-				statusCode = sh label: 'build', script: 'cd ' + git_folder + '; make defconfig; make download; make -j$((`nproc` + 1))', returnStatus:true
-			}
-			catch (e)
-			{
-				printDebug(e)
-				printDebug('multicore build failed -> trying to build verbosely on a single core')
-				//sh label: 'build', script: 'cd ' + git_folder + '; make defconfig; make download; make -j1 V=sc'
-			}
-			finally
-			{
-				//empty
-			}
-		}
-			
-		stage('move_bin_to_ftp')
-		{
-			sh label: 'copy_binaries', script: 'python ' + scripts_path + 'sftp_test.py -a ' + sftp_host + ' -u ' + sftp_user + ' -p ' + params.SFTP_PASSWD + ' -g ' + git_folder + ' -f ' + scripts_path + known_hosts + ' -l ' + sftp_path + ' -c ' + bin_path
-		}
-	}
-		
-	def post_build()
-	{ 
-		if(post_clean)
+		if(pre_clean)
 		{
 			cleanWs()
 		}
-
-		if((!isBuildNeeded && deleteUnbuild))
+		sh label: 'checkout_configs', script: 'git clone ' + script_git + ' ' + script_folder
+		sh label: 'checkout_openwrt', script: 'git clone ' + git_link + ' ' + git_folder
+		def ret = sh label: 'is_build_needed', script: 'set +x; python ' + scripts_path + 'sftp_test.py -a ' + sftp_host + ' -u ' + sftp_user + ' -p ' + params.SFTP_PASSWD + ' -g ' + git_folder + ' -f ' + scripts_path + known_hosts + ' -l ' + sftp_path + '; set -x', returnStdout: true
+		if(ret.trim().equalsIgnoreCase('True'))
 		{
-			//if no build is needed, then the last build is deleted and the next build number is set to previous build number
-			
-			def jobName = JOB_NAME
-			def job = Jenkins.instance.getItem(jobName)
-			job.getLastBuild().delete()
-			//printDebug('NUMBER:' + job.nextBuildNumber)
-			//logger.printInfo('job is getting deleted ' + currentBuild.id.toString())//job.nextBuildNumber)
-			//job.nextBuildNumber -= 1 //updateNextBuildNumber(job.getNextBuildNumber() - 1)      //resetting next build number does not work. if done, the next build start will do nothing
-			//job.saveNextBuildNumber()
-			//job.updateNextBuildNumber(job.nextBuildNumber - 1)
-			//printDebug('NUMBER_after:' + job.nextBuildNumber)
-			job.save()
+			isBuildNeeded = true
 		}
 	}
-	
+}
+
+def pre_build()
+{
+	stage('pre-build')
+	{
+		sh label: 'patch_sources', script: 'cd ' + git_folder + '; patch -p1 < ../' + patch
+		sh label: 'feeds_update', script: 'cd ' + git_folder + '; ./scripts/feeds update -a'
+		sh label: 'feeds_install', script: 'cd ' + git_folder + '; ./scripts/feeds install -a'
+	}
+}
+
+def build()
+{
+	stage('build')
+	{
+		sh label: 'copy_config', script: 'cp ' + config_path + 'tl_wr841_config ' + git_folder + '/.config'
+		try
+		{
+			statusCode = sh label: 'build', script: 'cd ' + git_folder + '; make defconfig; make download; make -j$((`nproc` + 1))', returnStatus:true
+		}
+		catch (e)
+		{
+			printDebug(e)
+			printDebug('multicore build failed -> trying to build verbosely on a single core')
+			//sh label: 'build', script: 'cd ' + git_folder + '; make defconfig; make download; make -j1 V=sc'
+		}
+		finally
+		{
+			//empty
+		}
+	}
+			
+	stage('move_bin_to_ftp')
+	{
+		sh label: 'copy_binaries', script: 'python ' + scripts_path + 'sftp_test.py -a ' + sftp_host + ' -u ' + sftp_user + ' -p ' + params.SFTP_PASSWD + ' -g ' + git_folder + ' -f ' + scripts_path + known_hosts + ' -l ' + sftp_path + ' -c ' + bin_path
+	}
+}
+		
+def post_build()
+{ 
+	if(post_clean)
+	{
+		cleanWs()
+	}
+
+	if((!isBuildNeeded && deleteUnbuild))
+	{
+		//if no build is needed, then the last build is deleted and the next build number is set to previous build number
+		
+		def jobName = JOB_NAME
+		def job = Jenkins.instance.getItem(jobName)
+		job.getLastBuild().delete()
+		//printDebug('NUMBER:' + job.nextBuildNumber)
+		//logger.printInfo('job is getting deleted ' + currentBuild.id.toString())//job.nextBuildNumber)
+		//job.nextBuildNumber -= 1 //updateNextBuildNumber(job.getNextBuildNumber() - 1)      //resetting next build number does not work. if done, the next build start will do nothing
+		//job.saveNextBuildNumber()
+		//job.updateNextBuildNumber(job.nextBuildNumber - 1)
+		//printDebug('NUMBER_after:' + job.nextBuildNumber)
+		job.save()
+	}
+}
+	
+def notify()
+{
+	def body_text = "${JOB_NAME} - Build # ${BUILD_NUMBER} - ${currentBuild.currentResult}:<br>Check console output at ${BUILD_URL} to view the results."
+	def subject_text = "${JOB_NAME} - Build # ${BUILD_NUMBER} - ${currentBuild.currentResult}!"
+	
+	emailext body: body_text, subject: subject_text, to: 'psychowoife@gmail.com'
 }