Added swapping functionality back