Added swap function