Changing to int and adding some logging.