Changed all print statements to use stderr

Because stdout is buffered printing is done to stderr to ensure it is displayed. Ie. If an error is encountered and a message is printed to stdout then the program exits, the message may not be flushed from the stdout buffer before the program terminates.