Added ad-hoc thread-specific context creation

Not sure if it's really a good idea or if I just needed it to hack something quick.