Removed redundant if
Removed redundant XOR