When we reach the end, I'm providing `null`, not `undefined`.  You'll have to change this to get this to work properly.