Updated pancake sorting