Commented and updated priority shuffle