Updated thread environments

Thread environments now will ALWAYS contain the process ID of the thread
so that the thread will be able to set itself up as the thread with
focus using the ProgramManager.