Fixed stupid loop logic.

Oh hey, maybe this thing actually works now.