changed to swap function only