Improve startup performance, by moving cleanup tasks and running them
in a thread in the background.