The `session` variable is never read and only assigned here. What do we need it for? If it is actually needed, can it be a variable local to this thread?