variables can be referenced inside a thread

A third argument to addThread was added than allows you to reference
external variables from inside a thread. It can be a dictionary that
contains several references, each with its own key/name