hardcore way to implement XO