Moved thread-specific functionality to new file.