Beginning of thread work.