Replaced print statements by logging.