added more logging code