Added Semaphore so we can write specs for threads.
Cleanup.