Began working on the 'clean shutdown' code for the new thread architecture.