Adding edits to char swap function