Fixed end processing condition.
The update function kept getting scheduled bercause of incorrect end condition.