change nest.apply -> nest.each
take Mike's comment into account