working on interrupts and thred safety