Some changes I made while chasing the slots 'A' and 'B' bug. These weren't necessary to fix that and I don't think they produce any change in behavior, aside from making the "Bad window id N" panic be more specific if it occurs.