Improved swap animation by correcting sortElement indices and turning off buttons after swap.