Added logging code.