update code with logging messages