changed around traiing for xor function a bit