Add basic support for moving threads.
Improvements!
some more improvements, by me