defs should commit this to master

refactored threading to use closeable thread. HOPE IT WORKS FINGERS
CROSSED