diff --git a/display.c b/display.c
index 4c4821433bcc7981afe4ee8c5786f9ed079f2595..9f70dedb12fd78e35a637fd521ea69bdbfa54a93 100644
--- a/display.c
+++ b/display.c
@@ -6,6 +6,7 @@
 
 int object_height; // global for convenience
 
+
 SDL_Window* init_display(){
 	int one_arm_width, one_arm_height;
 	SDL_Window *window;
@@ -53,8 +54,8 @@ void display_wheel(int pixel,int offset){
 
 
 void *display_func(void *param){
-	printf("\ndisplay_func");
 	SDL_Window* window = init_display();
+	printf("\ndisplay_func");
 	machine* mas = (machine *) (param);
 
 	while(1){
@@ -69,10 +70,10 @@ void *display_func(void *param){
 		}
 
 		for(int i=0; i<3; i++){
-			//pthread_mutex_lock(&mas->wheels[i].lock);
+			pthread_mutex_lock(&mas->wheels[i].lock);
 			int current_px = mas->wheels[i].current_px;
-			//pthread_mutex_unlock(&mas->wheels[i].lock);
-			display_wheel(85+104*i + 1, current_px);
+			pthread_mutex_unlock(&mas->wheels[i].lock);
+			display_wheel(85+(104*i + 1), current_px);
 		}
 
 
diff --git a/game.c b/game.c
index 99c2c818917d1168a74d80f79253882d4119b564..acc79dd40a7052d604be37f2ffef397138d214da 100644
--- a/game.c
+++ b/game.c
@@ -18,13 +18,13 @@ wheel create_wheel(int pixel,int speed){
 	wheel ret;
 	ret.current_px = pixel;
 	ret.speed = speed;
-  	//pthread_mutex_init(&ret.lock,NULL);
+  	pthread_mutex_init(&ret.lock,NULL);
 	return ret;
 
 }
 
-machine new_machine(machine mas, int nb_wheels){
+void new_machine(machine* mas, int nb_wheels){
   for (int i = 0; i < nb_wheels; i++) {
-    mas.wheels[i] = create_wheel(96,nb_wheels-i);
+    mas->wheels[i] = create_wheel(96,nb_wheels-i);
   }
 }
diff --git a/game.h b/game.h
index 46f4c608f91e098208359ba905f56dcfaee34a07..95b2ba64140fdc2078616cbd325ffd0ab92dd881 100644
--- a/game.h
+++ b/game.h
@@ -7,6 +7,8 @@
 
 #include "wheel.h"
 #include <stdlib.h>
+#include <SDL2/SDL.h>
+#include <SDL2/SDL_image.h>
 
 
 typedef struct machine_a_sous{
@@ -19,6 +21,6 @@ int insert_coin();
 int set_wheel_speed(int index);
 int next_wheel();
 wheel create_wheel(int pixel,int speed);
-machine new_machine(machine mas, int nb_wheels);
+void new_machine(machine* mas, int nb_wheels);
 
 #endif
diff --git a/one_armed_bandit.c b/one_armed_bandit.c
index 4c8110579a1754c110171574f664ec99932577a3..07155b8eb28aecc815adf347f8719f7546bd7e53 100644
--- a/one_armed_bandit.c
+++ b/one_armed_bandit.c
@@ -19,17 +19,17 @@
 
 int main()
 {
-
+	
 	pthread_t threads[4];
 
 	machine mas;
-	mas = new_machine(mas, 3);
-	run_thread(&threads[3],display_func,&mas);
+	new_machine(&mas, 3);
+	
 	for(int i = 0; i<3; i++){
 		run_thread(&threads[i],wheel_func,&mas.wheels[i]);
 	}
 	
-	
+	run_thread(&threads[3],display_func,&mas);
 
 	
 
diff --git a/wheel.c b/wheel.c
index 5ba0f5969a37047cd31509af39f9734614157111..465fce06208c3812ec09714aa54da053bf0d003e 100644
--- a/wheel.c
+++ b/wheel.c
@@ -3,6 +3,7 @@
 #include "wheel.h"
 
 
+
 int set_speed(int s){
     return -1;
 }
@@ -26,15 +27,15 @@ void *wheel_func(void *param){
 
             // wheel_spin(a,id.current_px,id.speed);
       wheel_spin_1_tick(id);
-      //wait_until(wheel_delay_ms(*id));
+      wait_until(wheel_delay_ms(*id));
     }
 }
 
 int wheel_spin_1_tick(wheel* this){
   if (this->speed) {
-    // mutex
+    pthread_mutex_lock(&this->lock);
     this->current_px = (this->current_px + 2) % 896 ;
-    // mutex
+    pthread_mutex_unlock(&this->lock);
   }
 }
 
diff --git a/wheel.h b/wheel.h
index a6d0dc99cdccd98b81a7e6b43edd67633f351811..bfa751e3257a20bcc571daab9c9df5d0a2cd7aea 100644
--- a/wheel.h
+++ b/wheel.h
@@ -6,7 +6,7 @@
 typedef struct roue{
   int speed;
   int current_px;
-  //pthread_mutex_t lock;
+  pthread_mutex_t lock;
 } wheel;