Change for to ensure proper iteration order.

Fixes #3.