Replaced print statements with logging.