Improved threads with context

* Added a thread contex for per thread for holding info about id etc.
* Added some to do stuff