Changes to use new shuffle library
Implementation of prev