added threadlocal; default_context is now a thread local instance