Rearrange some stuff and add EOR.