minor cleanups of Thread code