added my own swap function