updated to checkoutput and for errors.  exit with status = 1 if errors