rpi doing the Exercises

Having sorted, i bet you could use one splice (see page 51) rather than multiple unshift and shift operations.