diff --git a/ex_5/main.c b/ex_5/main.c
index 2cdcc067b91e7c422eb23aeed7db25ee8755d7b3..5c2140a82cd99400d29a4f961d4a52b895c0f30f 100644
--- a/ex_5/main.c
+++ b/ex_5/main.c
@@ -74,10 +74,25 @@ struct bmi160_fifo_frame fifo_frame;
 // 200 bytes -> ~7bytes per frame -> ~28 data frames
 struct bmi160_sensor_data acc_data[28];
 
+/**
+* Function for reading FIFO data
+*/
+int8_t get_bmi160_fifo_data()
+{
+  int8_t rslt = BMI160_OK;
+  uint8_t acc_frames_req = 28;
+  // Read the fifo buffer using SPI
+  rslt = bmi160_get_fifo_data(&sensor);
+  // Parse the data and extract 28 accelerometer frames
+  rslt = bmi160_extract_accel(acc_data, &acc_frames_req, &sensor);
+  return rslt;
+}
+
 /**
 * SPI user event handler.
 */
 void spi_event_handler(nrf_drv_spi_evt_t const * p_event, void *p_context) {
+  get_bmi160_fifo_data();
   spi_xfer_done = true; // Set a flag when transfer is done
 }
 
@@ -232,7 +247,7 @@ uint32_t config_gpio() {
   //config.pull = NRF_GPIO_PIN_PULLUP;
 
   // Configure the pin as input
-  err_code = nrf_drv_gpiote_in_init(INT_PIN, &config, button_handler);
+  err_code = nrf_drv_gpiote_in_init(INT_PIN, &config, spi_event_handler);
   if (err_code != NRF_SUCCESS) {
     // handle error condition
   }
@@ -242,20 +257,6 @@ uint32_t config_gpio() {
   return err_code;
 }
 
-/**
-* Function for reading FIFO data
-*/
-int8_t get_bmi160_fifo_data()
-{
-  int8_t rslt = BMI160_OK;
-  uint8_t acc_frames_req = 28;
-  // Read the fifo buffer using SPI
-  rslt = bmi160_get_fifo_data(&sensor);
-  // Parse the data and extract 28 accelerometer frames
-  rslt = bmi160_extract_accel(acc_data, &acc_frames_req, &sensor);
-  return rslt;
-}
-
 int main(void) {
 
   uint32_t err_code = spi_config();