added swap functions