The while(!Serial) line is not a problem - Serial is defined so it will just hop right over that.
That bit is there for compatibility with the Arduino Micro and Leonardo - until the computer connects to the native USB, there's no way for it to output serial. So to ensure that you don't miss the beginning of the serial output, that line waits until the computer has connected. That line has no effect on boards that don't have native USB (which is the case for the Uno, Nano, Pro Mini and many others).