Added while loops.
Self-review.