formatting, swap function fails