Handling background tasks version 1

Maybe add a comment above this line explaining that the Thread Locals are available.