Added while loops to main