Swap Algorithm Implemented