Tried to merge in Greg's changes fixing the messed up stuff.