- added swap function