Use enumerator instead of deprecated iterator