Cleaned up interrupt handling code.