made xor use less memory