STYLE: Move data matrix formation inside the iteration function.