Changed to stderr instead of default print, to avoid buffering when
printing in a loop