readded swap. it did not work since it expected array indices and was passed the values instead.