Added while loops and comparisons