Don't call iterate DOM several times in handlers