Index: Jenkinsfile
===================================================================
--- Jenkinsfile	(revision d189e116f02ddd9be6bbd7c739777762f2670be9)
+++ Jenkinsfile	(revision 77f347d1c8509dbee8624f8d6d908e6b8338ca40)
@@ -1,47 +1,55 @@
 
+def build() {
+	build_stage 'Checkout'
+
+		//checkout the source code and clean the repo
+		sh 'rm -rf *'
+		checkout scm
+
+	build_stage 'Build'
+
+		//Configure the conpilation (Output is not relevant)
+		//Use the current directory as the installation target so nothing
+		//escapes the sandbox
+		//Also specify the compiler by hand
+		def install_dir = pwd tmp: true
+		sh "CC=gcc-4.9 CXX=g++-4.9 ./configure --prefix=${install_dir} > /dev/null"
+
+		//Compile the project
+		sh 'make -j 8 install'
+
+	build_stage 'Test'
+
+		status_prefix = 'Test'
+
+		dir ('src/examples') {
+			sh './runTests.sh'
+		}
+
+	build_stage 'Cleanup'
+
+		//install doesn't need to be cleaned since prefix uses temporary workspace
+}
+
+def Compiler
+
+def build_stage(String name) {
+	def stage_name = "${Compiler} ${name}"
+	stage stage_name
+
+		status_prefix = stage_name
+}
 
 node ('master'){
 
 	def err = null
-	def stage_name
+	def status_prefix
 	def log_needed = false
 	currentBuild.result = "SUCCESS"
 
 	try {
+		Compiler = 'gcc-4.9'
+		build()
 
-		stage 'Checkout'
-
-			//checkout the source code and clean the repo
-			checkout scm
-			sh 'git clean -dfq'
-
-		stage 'Build'
-
-			stage_name = 'Build'
-
-			//Clean the directory (Output is not relevant)
-			sh 'make clean > /dev/null'
-
-			//Configure the conpilation (Output is not relevant)
-			//Use the current directory as the installation target so nothing
-			//escapes the sandbox
-			//Also specify the compiler by hand
-			def install_dir = pwd tmp: true
-			sh "CC=gcc-4.9 CXX=g++-4.9 ./configure --prefix=${install_dir} > /dev/null"
-
-			//Compile the project
-			sh 'make -j 8 install'
-
-		stage 'Test'
-
-			stage_name = 'Test'
-
-			dir ('src/examples') {
-				sh './runTests.sh'
-			}
-
-		stage 'Cleanup'
-
-			//install doesn't need to be cleaned since prefix uses temporary workspace
 	}
 
@@ -49,13 +57,5 @@
 		err = caughtError
 		log_needed = true
-		currentBuild.result = "FAILURE"
-
-		switch(stage_name) {
-			case 'Test' :
-				currentBuild.result = "TEST FAILURE"
-				break
-			default :
-				break
-		}
+		currentBuild.result = "${status_prefix} FAILURE"
 	}
 
