Small modifications to TWI

* Added the interrupt to the while loop
* Added the interrupt handler