changed our loops condition to be more readable