Change creation of a new array with encoded path to simply mapping the values from the old array onto itself.