simple version using two interrupts but working.