moved xor-testtraining into a function