Added a thread exit statement