Corrected bugs to thread synchronization.  Probably still not quite right.  Oh well.