added method for swap_with_next