Rely less on thread-local variables.
Remove some unused demo code.