adjusted to use pyx_iteration