clean up
doing with the structure do...while and xor within swap