swap depricated function