Implement iterator.

Closes #50.