added function swap