Fixed some problems with the way swaps take place.