clean up some code, add timeout to interrupts