Further rewrote iteration.js, should be good now