Found out about loop, so replaced while (true).