adding thread exit code