Added logging code