Thread Changes

Merging thread changes to dev-branch