added more spegetti fixes to Yifan's WTF code. There are simply too many things wrong here.