implemented the interrupt functionality