Fix hacky_swap_node to not repeatedly swap the same node in over and over