Refactor checking of thread state