Fixed shift function to use all and not generate an array