made swap method