Rework of the while loop

Modified the while loop to use a boolean instead of
always forcing a break. A server start failure
still causes a break. This avoids the need for
another boolean to track whether an error occurred.