Runs on troi, but problem with exiting thread.