small improvements to shuffle