Fixed up threadState and implemented printing stuff