created a function to create a thread dictionary, and fixed that silly whitespace issue on references.