Added function swapping.