Sadly, your version doesn't pass the tests.  I guess it's to do with `Array(oldval)`.  I'll clean up the rest, though.